import java.util.Objects;
import java.util.Observable;
//<T>表示当前类是泛型类
class MyArray<T>{
 // public T[] array=(T[]) new Object[10];
    public Object[] array=new Object[10];
  public void setArray(int pos,T val){
           array[pos]=val;
  }
  public T getArray(int pos){
      return (T)array[pos];
  }

}
class Person{

}
public class Test {
    public static void main(String[] args) {
            MyArray<Integer> myArray=new MyArray<>();
            myArray.setArray(0,1);
            myArray.setArray(1,2);
        System.out.println(myArray.getArray(0));
        MyArray<String> myArray1=new MyArray<>();
        myArray1.setArray(0,"hello");
        myArray1.setArray(1,"world");
        String s=myArray1.getArray(0);
        System.out.println(s);
        MyArray<Person> myArray2=new MyArray<>();
    }
}
